﻿<Page x:Class="SlaktDataReader.Pages.pgDeath"
      xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
      xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
      xmlns:local="clr-namespace:SlaktDataReader"
      mc:Ignorable="d" 
      DataContext="{Binding RelativeSource={RelativeSource self}}"
      d:DesignHeight="600" d:DesignWidth="900"
	Title="pgDeath">
    <Page.Resources>
        <local:titleFirstSurName x:Key="tfsConv" />

        <DataTemplate x:Key="dName">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Path=Title}" />
                <TextBlock FontWeight="Bold">
                    <TextBlock.Text>
                        <MultiBinding Converter="{StaticResource tfsConv}">
                            <Binding Path="Title" />
                            <Binding Path="FirstName" />
                            <Binding Path="SurName" />
                        </MultiBinding>
                    </TextBlock.Text>
                </TextBlock>
            </StackPanel>
        </DataTemplate>

    </Page.Resources>
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="55" />
            <RowDefinition Height="330*" />
            <RowDefinition Height="215" />
        </Grid.RowDefinitions>
        <Grid />
        <Grid Grid.Row="0" Background="{DynamicResource DarkColor1}"  >
            <!-- Background="#FF3D4F60" -->
            <Grid.ColumnDefinitions>
                <ColumnDefinition />
                <ColumnDefinition />
            </Grid.ColumnDefinitions>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Grid.ColumnSpan="2">
                
                <Border Width="60" BorderBrush="{DynamicResource BookColor1}" Background="{DynamicResource BookColor1}" BorderThickness="1">
                    <TextBlock Text="D" Foreground="White" FontSize="48" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Garamond" />
                </Border>
                <TextBlock Style="{StaticResource BirthBookHeader}" ><Run FontWeight="Bold">DÖDS</Run>BOK</TextBlock>
                <TextBlock Style="{StaticResource BirthBookTitle}" Text="{Binding Path=DeathBook.FriendlyName}" Margin="10,10,0,0" />
                <TextBlock Style="{StaticResource BirthBookTitle}" Text="{Binding Path=DeathBook.Period}" Margin="10,10,0,0" />
            </StackPanel>
            <StackPanel Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
            <Button Grid.Column="1" Name="bFilter" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,20,0" Width="75" Height="25" Content="Filter" Click="bFilter_Click" />
            <Button x:Name="bback" Content="X" Width="40" Height="25" Margin="10,0,10,0" Click="bback_Click"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="1">
            <ListView Name="lvDeath" Margin="0,0,0,20" BorderBrush="Transparent" BorderThickness="0" ItemsSource="{Binding Path=DeathBookData.Items}" >
                <ListView.View>
                    <GridView>
                        <GridViewColumn Header="LotNo" DisplayMemberBinding="{Binding Path=RowID}" />
                        <GridViewColumn Header="Sida"  DisplayMemberBinding="{Binding Path=PageNo}"/>
                        <GridViewColumn Header="Kön" DisplayMemberBinding="{Binding Path=Gender}" />
                        <GridViewColumn Header="Död" DisplayMemberBinding="{Binding Path=DeadDate}"/>
                        <GridViewColumn Header="Begravd" DisplayMemberBinding="{Binding Path=BurialDate}" />
                        <GridViewColumn Header="Namn" CellTemplate="{StaticResource dName}" />
                        <GridViewColumn Header="Ålder" DisplayMemberBinding="{Binding Path=DeadAge}" />
                        <GridViewColumn Header="Orsak" DisplayMemberBinding="{Binding Path=DeadReason}" />

                        <GridViewColumn Header="Anhörig 1" DisplayMemberBinding="{Binding Path=Related1}" />
                        <GridViewColumn Header="Anhörig 2" DisplayMemberBinding="{Binding Path=Related2}"/>
                        <GridViewColumn Header="Ort" DisplayMemberBinding="{Binding Path=Address}"/>
                    </GridView>
                </ListView.View>
            </ListView>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Bottom">
                <TextBlock Name="textBlock1" Text="Antal poster: " />
                <TextBlock Margin="8,0,10,0" Text="{Binding ElementName=lvDeath, Path=Items.Count}" FontWeight="Bold" Foreground="{DynamicResource BookColor2}"/>
            </StackPanel>
        </Grid>
        <Grid Grid.Row="2" Background="{DynamicResource BG1}">

        </Grid>
        <Border Grid.RowSpan="3" Width="650" Height="330" Background="White" BorderBrush="{DynamicResource BookColor1}" BorderThickness="2" CornerRadius="4" Name="FilterWindow" Visibility="Collapsed">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="120" />
                    <ColumnDefinition Width="238*" />
                    <ColumnDefinition Width="288*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="65" />
                    <RowDefinition Height="45" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="*" />
                </Grid.RowDefinitions>

                <Grid Grid.Column="0" Grid.ColumnSpan="3" Background="#E0F0E0">
                    <Border Width="60" BorderBrush="{DynamicResource BookColor1}" Background="{DynamicResource BookColor1}" BorderThickness="1" HorizontalAlignment="Left">
                        <TextBlock Text="D" Foreground="White" FontSize="48" HorizontalAlignment="Center" VerticalAlignment="Center" FontFamily="Garamond" />
                    </Border>

                    <TextBlock HorizontalAlignment="Left" Margin="134,0,0,0" Name="textBlock2" Text="FILTRERA RESULTAT" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="28" Grid.Column="1" />

                </Grid>
                <TextBlock Grid.Row="1" HorizontalAlignment="Left" Margin="14,0,0,5" Text="Förnamn" VerticalAlignment="Bottom" Grid.Column="1" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="16" />
                <TextBlock Grid.Row="1" Grid.Column="2" HorizontalAlignment="Left" Margin="20,0,0,5" Text="Efternamn" VerticalAlignment="Bottom" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="16" />
                <TextBlock Grid.Row="2" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Den döde:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}" />
                <TextBlock Grid.Row="3" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Anhörig 1:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}"/>
                <TextBlock Grid.Row="4" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Anhörig 2:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}"/>

                <TextBlock Grid.Row="5" HorizontalAlignment="Right" Margin="0,0,10,0" Text="Ort:" VerticalAlignment="Center" FontFamily="../Fonts/OpenSans-Regular.ttf#Open Sans" FontSize="18" FontWeight="Normal" Foreground="{StaticResource DarkColor2}"/>
                <TextBox Grid.Row="2" HorizontalAlignment="Left" Margin="14,0,0,0" Name="cfirst" VerticalAlignment="Center" Width="216" Grid.Column="1" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="2" Grid.Column="2" HorizontalAlignment="Left" Margin="20,0,0,0" Name="csur" VerticalAlignment="Center" Width="216" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="3" HorizontalAlignment="Left" Margin="14,0,0,0" Name="rel1" VerticalAlignment="Center" Width="216" Grid.Column="1" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="4" HorizontalAlignment="Left" Margin="14,0,0,0" Name="rel2" VerticalAlignment="Center" Width="216" Grid.Column="1" Style="{StaticResource stdTextBox}" />
                <TextBox Grid.Row="5" Grid.Column="1" HorizontalAlignment="Left" Margin="14,0,0,0" Name="Ort" VerticalAlignment="Center" Width="216" Style="{StaticResource stdTextBox}" />
                <Button Content="SÖK" Grid.Column="2" Grid.Row="6" Height="25" HorizontalAlignment="Right" Margin="0,13,52,0" Name="bApplyFilter" Click="bApplyFilter_Click" VerticalAlignment="Top" Width="100" Style="{StaticResource SearchButton}" />
            </Grid>
        </Border>

    </Grid>
</Page>
